package Leetcode;

public class Leetcode_230 {
    public static int partitionDisjoint(int[] nums) {
        int index = 0, max = nums[0], leftMax = max;
        for (int i = 1; i < nums.length; i++) {
            if (leftMax > nums[i]) {
                index = i;
                leftMax = max;
            } else {
                max = Math.max(max, nums[i]);
            }
        }
        return index + 1;
    }

    public static void main(String[] args) {
        int[] nums = {5,0,3,8,6};
        System.out.println(partitionDisjoint(nums));
    }
}
